package com.uestc.admin;

public class AdminFactory {

	public static enum adminOpt {
		FILEADMIN, USERADMIN, QINIUADMIN, USERLOGADMIN, USERFEEDBACKADMIN, INDEXADMIN
	}

	public static final String USER_ADMIN = "用户管理";
	public static final String FILE_ADMIN = "文件系统管理";
	public static final String USERLOG_ADMIN = "用户日志管理";
	public static final String SYSTEM_LOG_ADMIN = "系统日志管理";
	public static final String QINIU_ADMIN = "七牛云";
	public static final String USERFEEDBACK_ADMIN = "用户反馈管理";
	public static final String INDEX_ADMIN = "索引表管理";

	public static AdminBase getInstance(adminOpt opt) throws AdminException {
		if (opt == adminOpt.FILEADMIN)
			return new FileAdmin();
		else if (opt == adminOpt.USERADMIN)
			return new UserAdmin();
		else if (opt == adminOpt.QINIUADMIN)
			return new QiniuAdmin();
		else if (opt == adminOpt.USERLOGADMIN)
			return new UserLogAdmin();
		else if (opt == adminOpt.USERFEEDBACKADMIN)
			return new UserFeedBackAdmin();
		else if (opt == adminOpt.INDEXADMIN)
			return new IndexAdmin();
		throw new AdminException(AdminException.ADMIN_CHOICE_NOT_FOUND);
	}

	public static AdminBase getInstance(String opt) throws AdminException {
		if (FILE_ADMIN.equals(opt))
			return new FileAdmin();
		else if (USER_ADMIN.equals(opt))
			return new UserAdmin();
		else if (QINIU_ADMIN.equals(opt))
			return new QiniuAdmin();
		else if (USERLOG_ADMIN.equals(opt))
			return new UserLogAdmin();
		else if (SYSTEM_LOG_ADMIN.equals(opt))
			return new SystemLogAdmin();
		else if (USERFEEDBACK_ADMIN.equals(opt))
			return new UserFeedBackAdmin();
		else if (INDEX_ADMIN.equals(opt))
			return new IndexAdmin();
		throw new AdminException(AdminException.ADMIN_CHOICE_NOT_FOUND);
	}
}
